﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Collections.ObjectModel;

namespace Barbar.Colonization.Core {
  public static class CollectionConvert {
    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix", MessageId = "T")]
    public static Collection<AbstractType> ToCollection<AbstractType, ConcreteType>(Collection<ConcreteType> collection) where ConcreteType : AbstractType {
      Collection<AbstractType> result = new Collection<AbstractType>();
      foreach (ConcreteType item in collection)
        result.Add((AbstractType)item);
      return result;
    }
  }
}
